package com.sk.bilibili.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sk.bilibili.bean.Banner;
import com.sk.bilibili.bean.ThemBanner;
import com.sk.bilibili.other.R;
import com.sk.bilibili.service.ThemBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
* @author 邵康
* @date 2021/11/27 10:21
*/
@Api(tags = "番剧轮播图")
@CrossOrigin
@RestController
@RequestMapping("/themBanner")
public class ThemBannerController {

    @Autowired
    private ThemBannerService themBannerService;

    @ApiOperation("添加除了Id其他都需要")
    @PostMapping("/add")
    public R<Void> add( ThemBanner themBanner){
        return themBannerService.add(themBanner);
    }

    @ApiOperation("根据类型获取 Banner  暂时 只能传 2 3")
    @GetMapping("/getThemBanner")
    public R<List<ThemBanner>> getThemBanner(Integer typeId){
        return themBannerService.getThemBanner(typeId);
    }

    @ApiOperation("deleteRes")
    @GetMapping("/delete")
    public R<Void> delete(Integer id){
        return themBannerService.delete(id);
    }

    @ApiOperation("update")
    @PostMapping("/update")
    public R<Void> update( ThemBanner themBanner){
        return themBannerService.update(themBanner);
    }

    @ApiOperation("pageSearch")
    @GetMapping("/page")
    public R<IPage<ThemBanner>> page( @RequestParam(defaultValue = "1") Integer page,
                                @RequestParam(defaultValue = "10") Integer size){
        return themBannerService.page(page,size);
    }

}
